package com.bestdreamer.arrays;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Vector;


public class ListDemo {

    @Test
    public void LinkedListDemo(){

        System.out.println("========LinkedList========");
        LinkedList<Integer> list = new LinkedList<>(Arrays.asList(0,1,2,3,4,5,6,7,8,9,10,11));
        System.out.println(list);
        System.out.println(list.get(3));
        System.out.println(list.get(9));
        LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.add(11);

        System.out.println("========ArrayList========");
        ArrayList<Integer> arrayList = new ArrayList<>(Arrays.asList(0,1,2,3,4,5,6,7,8,9,10,11));
        System.out.println(arrayList);
        arrayList.add(12,20);
        System.out.println(arrayList);
        ArrayList<Integer> newArray = (ArrayList<Integer>) arrayList.clone();
        arrayList.clear();
        System.out.println(newArray);
        System.out.println("========vector========");

        Vector<Integer> vector = new Vector<>(Arrays.asList(0,1,2,3,4,5,6,7,8,9,10,11));
        System.out.println(vector);
        vector.add(12,21);
        System.out.println(vector);

        String[] as = new String[]{"1","2","3"};
        System.out.println(as.length);
    }
}
